using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;

namespace Stopwatch.AduioLibrary
{
    public class Sounds : System.IDisposable
    {
        SoundEffect completedEffect;
        SoundEffect tickEffect;

        protected ContentManager Content { get; set; }

        public Sounds(ContentManager content)
        {
            Content = content;
        }

        void Init()
        {
            if (Content == null)
            {
                throw new System.InvalidOperationException("Content is null.");
            }

            try
            {
                tickEffect = Content.Load<SoundEffect>("tick");
                completedEffect = Content.Load<SoundEffect>("completed");
            }
            catch { }
        }

        public void Tick()
        {
            tickEffect.Play();
        }

        public void Completed()
        {
            completedEffect.Play();
        }

        public void Dispose()
        {
            tickEffect.Dispose();
            completedEffect.Dispose();
        }
    }
}
